﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//using System.Xml.Linq;
using System.Collections.Generic;

using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;
using YouHP.Utility;

namespace web.admin
{
    public partial class AddHyperLink : System.Web.UI.Page
    {
        private HyperLinkBLL hyperLinkBll = HyperLinkBLL.Instance;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CancelButton_click(object sender, EventArgs e)
        {

        }
        protected void InsertButton_click(object sender, EventArgs e)
        {
            HyperLinkInfo info = validateForm(this.hyperLinkInfo);

            if (info != null)
            {
                if (hyperLinkBll.AddHyperLink(info))
                {
                   // Response.Redirect("NewsList.aspx");
                }
            }

        }
        protected void DataBound(object sender, EventArgs e)
        {

        }
        private HyperLinkInfo validateForm(DetailsView formViewCtl)
        {
             HyperLinkInfo info = new HyperLinkInfo();

            //info.IsNews = Convert.ToInt32(this.GroupId.Text);
            info.Title = ((TextBox)formViewCtl.FindControl("title")).Text;
            info.IsLogo = false;
            info.Brif = ((TextBox)formViewCtl.FindControl("introduction")).Text;
            info.CreateTime = DateTime.Now;
            info.LastUpdateTime = DateTime.Now;
            //info.Body = ((TextBox)formViewCtl.FindControl("body")).Text;


            return info;
        }
    }
}
